package com.example.a117.myapplication;

/**
 * Created by a117 on 2018/6/19.
 */


import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.nfc.Tag;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

//import android.app.Activity;
//import android.os.Bundle;

//public class register extends Activity{
  //  @Override
    //protected void onCreate(Bundle savedInstanceState) {
      //  super.onCreate(savedInstanceState);
        //setContentView(R.layout.register);
    //}
//}




public class register extends Activity {

    private Button button;
    //private Button readButton;
    private EditText account;
    private EditText password;
    String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.register);

        button = (Button) findViewById(R.id.button3);
        account = (EditText) findViewById(R.id.account);
        password = (EditText) findViewById(R.id.passeord);
        button.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
               // SharedPreferences.Editor editor = getSharedPreferences("data", MODE_PRIVATE).edit();
              //  editor.putString("name", account.getText().toString());
              //  editor.putString("password", password.getText().toString());
              //  editor.commit();

              //  finish();

                AlertDialog.Builder dialog = new AlertDialog.Builder(register.this);
                dialog.setTitle("提示");
                dialog.setMessage("注册成功,是否返回首页");
                dialog.setPositiveButton("确认", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                         SharedPreferences.Editor editor = getSharedPreferences("data", MODE_PRIVATE).edit();
                          editor.putString("name", account.getText().toString());
                          editor.putString("password", password.getText().toString());
                          editor.commit();
                          finish();

                    }
                });dialog.show();




            }
        });
    }

}